<template>
  <el-popconfirm
    title="确认删除?"
    confirm-button-text="确认"
    cancel-button-text="取消"
    @confirm="handlePositiveClick"
    @cancel="handleNegativeClick">
    <template #reference>
      <el-button v-permission="username" size="small" v-if="showBtn">删除</el-button>
      <slot></slot>
    </template>
    是否确认删除
  </el-popconfirm>
</template>

<script setup lang="ts">
  import { useUserStore } from '@/stores/userStore';
  const { username } = useUserStore().getUser();
  const emits = defineEmits(['confirm']);
  const props = defineProps({
    showBtn: {
      default: true
    }
  });
  const handlePositiveClick = () => {
    //   message.info('是的');
    emits('confirm');
  };
  const handleNegativeClick = () => {
    console.log('取消');
  };
</script>

<style lang="scss" scoped></style>
